package com.download.web.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.download.web.entity.SysSponsor;
import com.download.web.mapper.SysSponsorMapper;
import com.download.web.service.ISponsorService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
@Transactional
public class ISponsorServiceImpl extends ServiceImpl<SysSponsorMapper, SysSponsor> implements ISponsorService {

    @Resource
    private SysSponsorMapper sysSponsorMapper;

    @Override
    public SysSponsor selectById(int id) {
        try {
            SysSponsor sponsor=sysSponsorMapper.selectById(id);
            return sponsor;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    @Override
    public int updateSponsor(SysSponsor sponsor) {
        try {
            int count=sysSponsorMapper.updateById(sponsor);
            return count;
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
    }
}
